package com.group.project.hrms.service.impl;

import com.group.project.hrms.entity.SystemAuthenticationList;
import com.group.project.hrms.mapper.SystemAuthenticationListMapper;
import com.group.project.hrms.service.ISystemAuthenticationListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SystemAuthenticationListService implements ISystemAuthenticationListService {

    @Autowired
    private SystemAuthenticationListMapper systemAuthenticationListMapper;


    @Override
    public int insertSystemAuthenticationList(SystemAuthenticationList systemAuthenticationList) {
        return systemAuthenticationListMapper.insert(systemAuthenticationList);
    }

    @Override
    public int deleteSystemAuthenticationList(SystemAuthenticationList systemAuthenticationList) {
        return systemAuthenticationListMapper.deleteByPrimaryKey(systemAuthenticationList);
    }

    @Override
    public int updateSystemAuthenticationList(SystemAuthenticationList systemAuthenticationList) {
        return systemAuthenticationListMapper.updateByPrimaryKey(systemAuthenticationList);
    }

    @Override
    public SystemAuthenticationList selectOneSystemAuthenticationList(SystemAuthenticationList systemAuthenticationList) {
        return systemAuthenticationListMapper.selectByPrimaryKey(systemAuthenticationList);
    }

    @Override
    public SystemAuthenticationList selectSystemAuthenticationListByContactId(String cid) {
        Example example = new Example(SystemAuthenticationList.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.orEqualTo("contactId" , cid);
        return systemAuthenticationListMapper.selectOneByExample(example);
    }

    @Override
    public List<SystemAuthenticationList> selectAllSystemAuthenticationList() {
        return systemAuthenticationListMapper.selectAll();
    }
}
